#include <algorithm>
#include <time.h>
#include <iostream>

using namespace std;

int main (int argc, char **argv) {
  double pi;
  double x;
  double y;


  int in_number = 0; 
  int total_number = atoi(argv[1]);

 srand(time(NULL));

  for (int i = 0; i < total_number; i++) {
    x = double(rand()) / INT_MAX;
    y = double(rand()) / INT_MAX;

    if ((x * x + y * y) < 1)
  	  in_number += 1;
  }
  pi = 4.0 * in_number / total_number;

  cout << "pi =" << pi << endl;
}
